<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head th:replace="common/form :: head"></head>
	<body class="mainbody">
		<form method="POST" th:object="${obj}" onsubmit="valPermission();">
			<div th:replace="common/form :: location('菜单管理',*{id} gt 0 ?'修改菜单':'新增菜单')"></div>
			<div id="floatHead" class="content-tab-wrap">
			  <div class="content-tab">
			    <div class="content-tab-ul-wrap">
			      <ul>
			        <li><a href="javascript:;">菜单信息</a></li>
			      </ul>
			    </div>
			  </div>
			</div>
			<div class="tab-content">
				<dl>
					<dt>父级菜单</dt>
				    <dd>
				      	<div class="rule-single-select">
				    		<select th:field="*{parentId}" >
				    			<option value="0">无父级菜单</option>
				    			<option th:each="op:${@menuService.allMenus}" th:value="${op.id}" th:attr="data-depth=${#strings.arraySplit(op.path,',').length-1}"
				    				th:text="' ├ '+${op.name}"></option>
				    		</select>
				    	</div>
				    </dd>
				</dl>
				<dl>
					<dt>名称</dt>
				    <dd>
				      <input type="text" class="input normal" data-type="*1-6" th:field="*{name}" />
				      <span class="Validform_checktip">*菜单名称</span>
				    </dd>
				</dl>
				<dl>
					<dt>排序</dt>
				    <dd>
				      <input type="text" class="input normal" data-type="n1-6" th:field="*{sort}" />
				      <span class="Validform_checktip">*升序</span>
				    </dd>
				</dl>
				<dl>
					<dt>链接</dt>
				    <dd>
				      <input type="text" class="input normal" maxlength="100" th:field="*{href}" />
				      <span class="Validform_checktip">*链接</span>
				    </dd>
				</dl>
				<dl>
					<dt>目标</dt>
				    <dd>
				      <input type="text" class="input normal" maxlength="20" th:field="*{target}" />
				      <span class="Validform_checktip">*目标窗口（mainFrame、 _blank、_self、_parent、_top）</span>
				    </dd>
				</dl>
				<dl>
					<dt>图标</dt>
				    <dd>
				      <input type="text" class="input normal" maxlength="8" th:field="*{icon}" />
				      <span class="Validform_checktip">*顶级菜单才需要图标</span>
				    </dd>
				</dl>
				<dl>
					<dt>备注信息</dt>
					<dd>
						<textarea class="input normal" maxlength="50" rows="5" th:field="*{remarks}"></textarea>
						<span class="Validform_checktip"></span>
					</dd>
				</dl>
				<dl>
					<dt>权限标识</dt>
				    <dd>
				      <input type="text" class="input normal" maxlength="50" th:field="*{symbol}" />
				      <span class="Validform_checktip">*权限标识</span>
				    </dd>
				</dl>
				<dl>
					<dt>权限种类</dt>
				    <dd>
				    	<input type="hidden" name="permission" />
				    	<div class="rule-multi-porp" th:with="pm=*{permission?:1}">
						
							<input type="checkbox" th:checked="${pm}%2>0" value="1" />
							<label for="permission">查看</label>
						
							<input type="checkbox" th:checked="${pm}%4>1" value="2" />
							<label for="permission">添加</label>
						
							<input type="checkbox" th:checked="${pm}%8>3" value="4" />
							<label for="permission">修改</label>
						
							<input type="checkbox" th:checked="${pm}%16>7" value="8" />
							<label for="permission">删除</label>
							
						</div>
						<span class="Validform_checktip">取消选择则不对权限作校验</span>
				    </dd>
				</dl>
			</div>
			<div th:replace="common/form :: footer"></div>
		</form>
		<script type="text/javascript" th:inline="javascript">
		/*<![CDATA[*/
		function valPermission(){
			var sum=0;
			$(".rule-multi-porp").find(":checked").each(function(){
				sum+=parseInt($(this).val());
			});
			$("[name=permission]").val(sum);
		}
		$("option").each(function(){
			var _this=$(this);
			var depth=_this.data("depth");
			if(depth){
				var prefix="";
				for(var i=0;i < depth;i++)prefix+="&emsp;";
				_this.html(prefix+_this.html());
			}
		})
		/*]]>*/
		</script>
		<script type="text/javascript" th:replace="common/form :: formscript"></script>
	</body>
</html>